/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trunk.TBBS.Java;

import trunk.TBBS.Java.Spells.Ability;

/**
 *
 * @author Thomas
 */

public class combatData extends gameObject{
    static final String className = "Default";
    static final String classDesc = "Description";
    //Level
    int level, experience = 0, nextLevelReq = 1000;
    //Primary Statistics. 
    int stamina, intellect, strength, agility;
    int stamCof = 2, intCof = 1, strCof = 1, agiCof = 1;
    //Secondary Statistics
    int HP, MP, attack, magic, defense, resistance;
    int hpCof = 100, mpCof = 10;
    
    
    //Calculate the various stats. 
    private void calcPrimaryStats(int lvl){
        stamina = lvl * stamCof;
        intellect = lvl * intCof;
        strength = lvl * strCof;
        agility = lvl * agiCof;
    }
    public void calcSecondaryStats(){
        HP = stamina * hpCof;
        MP = intellect * mpCof;
        attack = 10 + strength * 2 + agility;
        magic = 10 + intellect * 3;
        defense = 10 + strength;
        resistance = 10 + intellect;        
    }
    //Constructors
    public combatData(){
        super(className,classDesc);
        calcPrimaryStats(1);
        calcSecondaryStats();        
    }
    public combatData(int lvl){
        super(className,classDesc);
        if(lvl > 60)
            lvl = 60;
        else if(lvl < 1)
            lvl = 1;
        calcPrimaryStats(lvl);
        calcSecondaryStats();
    }
    public combatData(int lvl, int stam, int str, int intt, int agi){
        super(className,classDesc);
        stamina = stam;
        strength = str;
        intellect = intt;
        agility = agi;
        calcSecondaryStats();
    }
    
    //Level Up:
    private void levelUp(){
        stamina += stamCof;
        strength += strCof;
        intellect += intCof;
        agility += agiCof;
        calcSecondaryStats();
        level++;        
    }
    public void affectExp(int val){
        experience += val;
        if(experience >= nextLevelReq){
            levelUp();
            experience =- nextLevelReq;
            return;
        }else if(experience < 0){
            experience = 0;
            return;
        }
    }
    
    @Override
    public String toString(){
        return "Job: " + super.name + "\n" +
               desc + "\n" +
                "Level: " + level + "\n" + 
               "Experience: " + experience + "/" + nextLevelReq + "\n" +
               "Health: " + HP + "\n" +
               "Mana: " + MP + "\n" +
               "Statistics: " + "\n" +
               "Attack: " + attack + "\n" +
               "Magic: " + magic + "\n" +
               "Defense: " + defense + "\n" +
               "Resistance: " + resistance + "\n" +
               "Base Statistics" + "\n" +
               "Stamina: " + stamina + "\n" +
               "Strength: " + strength + "\n" +
               "Intellect: " + intellect + "\n" +
               "Agility: " + agility + "\n";
    }
    
    
    
}
